home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / tex / tex31 / texsrc.lzh / TEXSRC.LZH / tex8.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-11-28  |  24.4 KB  |  1,013 lines

  1. #define EXTERN extern
  2. #include "texd.h"
  3.  
  4. void zshipout ( p ) 
  5. halfword p ; 
  6. {/* 30 */ shipout_regmem 
  7.   integer pageloc  ; 
  8.   schar j, k  ; 
  9.   poolpointer s  ; 
  10.   schar oldsetting  ; 
  11.   if ( eqtb [ 6197 ] .cint > 0 ) 
  12.   {
  13.     printnl ( 335 ) ; 
  14.     println () ; 
  15.     print ( 822 ) ; 
  16.   } 
  17.   if ( termoffset > maxprintline - 9 ) 
  18.   println () ; 
  19.   else if ( ( termoffset > 0 ) || ( fileoffset > 0 ) ) 
  20.   printchar ( 32 ) ; 
  21.   printchar ( 91 ) ; 
  22.   j = 9 ; 
  23.   while ( ( eqtb [ 6218 + j ] .cint == 0 ) && ( j > 0 ) ) decr ( j ) ; 
  24.   {register integer for_end; k = 0 ; for_end = j ; if ( k <= for_end) do 
  25.     {
  26.       printint ( eqtb [ 6218 + k ] .cint ) ; 
  27.       if ( k < j ) 
  28.       printchar ( 46 ) ; 
  29.     } 
  30.   while ( k++ < for_end ) ; } 
  31.   flush ( stdout ) ; 
  32.   if ( eqtb [ 6197 ] .cint > 0 ) 
  33.   {
  34.     printchar ( 93 ) ; 
  35.     begindiagnostic () ; 
  36.     showbox ( p ) ; 
  37.     enddiagnostic ( true ) ; 
  38.   } 
  39.   if ( ( mem [ p + 3 ] .cint > 1073741823L ) || ( mem [ p + 2 ] .cint > 
  40.   1073741823L ) || ( mem [ p + 3 ] .cint + mem [ p + 2 ] .cint + eqtb [ 6749 ] 
  41.   .cint > 1073741823L ) || ( mem [ p + 1 ] .cint + eqtb [ 6748 ] .cint > 
  42.   1073741823L ) ) 
  43.   {
  44.     {
  45.       if ( interaction == 3 ) 
  46.       wakeupterminal () ; 
  47.       printnl ( 262 ) ; 
  48.       print ( 826 ) ; 
  49.     } 
  50.     {
  51.       helpptr = 2 ; 
  52.       helpline [ 1 ] = 827 ; 
  53.       helpline [ 0 ] = 828 ; 
  54.     } 
  55.     error () ; 
  56.     if ( eqtb [ 6197 ] .cint <= 0 ) 
  57.     {
  58.       begindiagnostic () ; 
  59.       printnl ( 829 ) ; 
  60.       showbox ( p ) ; 
  61.       enddiagnostic ( true ) ; 
  62.     } 
  63.     goto lab30 ; 
  64.   } 
  65.   if ( mem [ p + 3 ] .cint + mem [ p + 2 ] .cint + eqtb [ 6749 ] .cint > maxv 
  66.   ) 
  67.   maxv = mem [ p + 3 ] .cint + mem [ p + 2 ] .cint + eqtb [ 6749 ] .cint ; 
  68.   if ( mem [ p + 1 ] .cint + eqtb [ 6748 ] .cint > maxh ) 
  69.   maxh = mem [ p + 1 ] .cint + eqtb [ 6748 ] .cint ; 
  70.   dvih = 0 ; 
  71.   dviv = 0 ; 
  72.   curh = eqtb [ 6748 ] .cint ; 
  73.   dvif = 0 ; 
  74.   if ( outputfilename == 0 ) 
  75.   {
  76.     if ( jobname == 0 ) 
  77.     openlogfile () ; 
  78.     packjobname ( 787 ) ; 
  79.     while ( ! bopenout ( dvifile ) ) promptfilename ( 788 , 787 ) ; 
  80.     outputfilename = bmakenamestring ( dvifile ) ; 
  81.   } 
  82.   if ( totalpages == 0 ) 
  83.   {
  84.     {
  85.       dvibuf [ dviptr ] = 247 ; 
  86.       incr ( dviptr ) ; 
  87.       if ( dviptr == dvilimit ) 
  88.       dviswap () ; 
  89.     } 
  90.     {
  91.       dvibuf [ dviptr ] = 2 ; 
  92.       incr ( dviptr ) ; 
  93.       if ( dviptr == dvilimit ) 
  94.       dviswap () ; 
  95.     } 
  96.     dvifour ( 25400000L ) ; 
  97.     dvifour ( 473628672L ) ; 
  98.     preparemag () ; 
  99.     dvifour ( eqtb [ 6180 ] .cint ) ; 
  100.     oldsetting = selector ; 
  101.     selector = 21 ; 
  102.     print ( 820 ) ; 
  103.     printint ( eqtb [ 6186 ] .cint ) ; 
  104.     printchar ( 46 ) ; 
  105.     printtwo ( eqtb [ 6185 ] .cint ) ; 
  106.     printchar ( 46 ) ; 
  107.     printtwo ( eqtb [ 6184 ] .cint ) ; 
  108.     printchar ( 58 ) ; 
  109.     printtwo ( eqtb [ 6183 ] .cint / 60 ) ; 
  110.     printtwo ( eqtb [ 6183 ] .cint % 60 ) ; 
  111.     selector = oldsetting ; 
  112.     {
  113.       dvibuf [ dviptr ] = ( poolptr - strstart [ strptr ] ) ; 
  114.       incr ( dviptr ) ; 
  115.       if ( dviptr == dvilimit ) 
  116.       dviswap () ; 
  117.     } 
  118.     {register integer for_end; s = strstart [ strptr ] ; for_end = poolptr - 
  119.     1 ; if ( s <= for_end) do 
  120.       {
  121.     dvibuf [ dviptr ] = strpool [ s ] ; 
  122.     incr ( dviptr ) ; 
  123.     if ( dviptr == dvilimit ) 
  124.     dviswap () ; 
  125.       } 
  126.     while ( s++ < for_end ) ; } 
  127.     poolptr = strstart [ strptr ] ; 
  128.   } 
  129.   pageloc = dvioffset + dviptr ; 
  130.   {
  131.     dvibuf [ dviptr ] = 139 ; 
  132.     incr ( dviptr ) ; 
  133.     if ( dviptr == dvilimit ) 
  134.     dviswap () ; 
  135.   } 
  136.   {register integer for_end; k = 0 ; for_end = 9 ; if ( k <= for_end) do 
  137.     dvifour ( eqtb [ 6218 + k ] .cint ) ; 
  138.   while ( k++ < for_end ) ; } 
  139.   dvifour ( lastbop ) ; 
  140.   lastbop = pageloc ; 
  141.   curv = mem [ p + 3 ] .cint + eqtb [ 6749 ] .cint ; 
  142.   tempptr = p ; 
  143.   if ( mem [ p ] .hh.b0 == 1 ) 
  144.   vlistout () ; 
  145.   else hlistout () ; 
  146.   {
  147.     dvibuf [ dviptr ] = 140 ; 
  148.     incr ( dviptr ) ; 
  149.     if ( dviptr == dvilimit ) 
  150.     dviswap () ; 
  151.   } 
  152.   incr ( totalpages ) ; 
  153.   curs = -1 ; 
  154.   lab30: ; 
  155.   if ( eqtb [ 6197 ] .cint <= 0 ) 
  156.   printchar ( 93 ) ; 
  157.   deadcycles = 0 ; 
  158.   flush ( stdout ) ; 
  159.     ;
  160. #ifdef STAT
  161.   if ( eqtb [ 6194 ] .cint > 1 ) 
  162.   {
  163.     printnl ( 823 ) ; 
  164.     printint ( varused ) ; 
  165.     printchar ( 38 ) ; 
  166.     printint ( dynused ) ; 
  167.     printchar ( 59 ) ; 
  168.   } 
  169. #endif /* STAT */
  170.   flushnodelist ( p ) ; 
  171.     ;
  172. #ifdef STAT
  173.   if ( eqtb [ 6194 ] .cint > 1 ) 
  174.   {
  175.     print ( 824 ) ; 
  176.     printint ( varused ) ; 
  177.     printchar ( 38 ) ; 
  178.     printint ( dynused ) ; 
  179.     print ( 825 ) ; 
  180.     printint ( himemmin - lomemmax - 1 ) ; 
  181.     println () ; 
  182.   } 
  183. #endif /* STAT */
  184. void zscanspec ( c , threecodes ) 
  185. groupcode c ; 
  186. boolean threecodes ; 
  187. {/* 40 */ scanspec_regmem 
  188.   integer s  ; 
  189.   schar speccode  ; 
  190.   if ( threecodes ) 
  191.   s = savestack [ saveptr + 0 ] .cint ; 
  192.   if ( scankeyword ( 835 ) ) 
  193.   speccode = 0 ; 
  194.   else if ( scankeyword ( 836 ) ) 
  195.   speccode = 1 ; 
  196.   else {
  197.       
  198.     speccode = 1 ; 
  199.     curval = 0 ; 
  200.     goto lab40 ; 
  201.   } 
  202.   scandimen ( false , false , false ) ; 
  203.   lab40: if ( threecodes ) 
  204.   {
  205.     savestack [ saveptr + 0 ] .cint = s ; 
  206.     incr ( saveptr ) ; 
  207.   } 
  208.   savestack [ saveptr + 0 ] .cint = speccode ; 
  209.   savestack [ saveptr + 1 ] .cint = curval ; 
  210.   saveptr = saveptr + 2 ; 
  211.   newsavelevel ( c ) ; 
  212.   scanleftbrace () ; 
  213. halfword zhpack ( p , w , m ) 
  214. halfword p ; 
  215. scaled w ; 
  216. smallnumber m ; 
  217. {/* 21 50 10 */ register halfword Result; hpack_regmem 
  218.   halfword r  ; 
  219.   halfword q  ; 
  220.   scaled h, d, x  ; 
  221.   scaled s  ; 
  222.   halfword g  ; 
  223.   glueord o  ; 
  224.   internalfontnumber f  ; 
  225.   fourquarters i  ; 
  226.   eightbits hd  ; 
  227.   lastbadness = 0 ; 
  228.   r = getnode ( 7 ) ; 
  229.   mem [ r ] .hh.b0 = 0 ; 
  230.   mem [ r ] .hh.b1 = 0 ; 
  231.   mem [ r + 4 ] .cint = 0 ; 
  232.   q = r + 5 ; 
  233.   mem [ q ] .hh .v.RH = p ; 
  234.   h = 0 ; 
  235.   d = 0 ; 
  236.   x = 0 ; 
  237.   totalstretch [ 0 ] = 0 ; 
  238.   totalshrink [ 0 ] = 0 ; 
  239.   totalstretch [ 1 ] = 0 ; 
  240.   totalshrink [ 1 ] = 0 ; 
  241.   totalstretch [ 2 ] = 0 ; 
  242.   totalshrink [ 2 ] = 0 ; 
  243.   totalstretch [ 3 ] = 0 ; 
  244.   totalshrink [ 3 ] = 0 ; 
  245.   while ( p != 0 ) {
  246.       
  247.     lab21: while ( ( p >= himemmin ) ) {
  248.     
  249.       f = mem [ p ] .hh.b0 ; 
  250.       i = fontinfo [ charbase [ f ] + mem [ p ] .hh.b1 ] .qqqq ; 
  251.       hd = i .b1 ; 
  252.       x = x + fontinfo [ widthbase [ f ] + i .b0 ] .cint ; 
  253.       s = fontinfo [ heightbase [ f ] + ( hd ) / 16 ] .cint ; 
  254.       if ( s > h ) 
  255.       h = s ; 
  256.       s = fontinfo [ depthbase [ f ] + ( hd ) % 16 ] .cint ; 
  257.       if ( s > d ) 
  258.       d = s ; 
  259.       p = mem [ p ] .hh .v.RH ; 
  260.     } 
  261.     if ( p != 0 ) 
  262.     {
  263.       switch ( mem [ p ] .hh.b0 ) 
  264.       {case 0 : 
  265.       case 1 : 
  266.       case 2 : 
  267.       case 13 : 
  268.     {
  269.       x = x + mem [ p + 1 ] .cint ; 
  270.       if ( mem [ p ] .hh.b0 >= 2 ) 
  271.       s = 0 ; 
  272.       else s = mem [ p + 4 ] .cint ; 
  273.       if ( mem [ p + 3 ] .cint - s > h ) 
  274.       h = mem [ p + 3 ] .cint - s ; 
  275.       if ( mem [ p + 2 ] .cint + s > d ) 
  276.       d = mem [ p + 2 ] .cint + s ; 
  277.     } 
  278.     break ; 
  279.       case 3 : 
  280.       case 4 : 
  281.       case 5 : 
  282.     if ( adjusttail != 0 ) 
  283.     {
  284.       while ( mem [ q ] .hh .v.RH != p ) q = mem [ q ] .hh .v.RH ; 
  285.       if ( mem [ p ] .hh.b0 == 5 ) 
  286.       {
  287.         mem [ adjusttail ] .hh .v.RH = mem [ p + 1 ] .cint ; 
  288.         while ( mem [ adjusttail ] .hh .v.RH != 0 ) adjusttail = mem [ 
  289.         adjusttail ] .hh .v.RH ; 
  290.         p = mem [ p ] .hh .v.RH ; 
  291.         freenode ( mem [ q ] .hh .v.RH , 2 ) ; 
  292.       } 
  293.       else {
  294.           
  295.         mem [ adjusttail ] .hh .v.RH = p ; 
  296.         adjusttail = p ; 
  297.         p = mem [ p ] .hh .v.RH ; 
  298.       } 
  299.       mem [ q ] .hh .v.RH = p ; 
  300.       p = q ; 
  301.     } 
  302.     break ; 
  303.       case 8 : 
  304.     ; 
  305.     break ; 
  306.       case 10 : 
  307.     {
  308.       g = mem [ p + 1 ] .hh .v.LH ; 
  309.       x = x + mem [ g + 1 ] .cint ; 
  310.       o = mem [ g ] .hh.b0 ; 
  311.       totalstretch [ o ] = totalstretch [ o ] + mem [ g + 2 ] .cint ; 
  312.       o = mem [ g ] .hh.b1 ; 
  313.       totalshrink [ o ] = totalshrink [ o ] + mem [ g + 3 ] .cint ; 
  314.       if ( mem [ p ] .hh.b1 >= 100 ) 
  315.       {
  316.         g = mem [ p + 1 ] .hh .v.RH ; 
  317.         if ( mem [ g + 3 ] .cint > h ) 
  318.         h = mem [ g + 3 ] .cint ; 
  319.         if ( mem [ g + 2 ] .cint > d ) 
  320.         d = mem [ g + 2 ] .cint ; 
  321.       } 
  322.     } 
  323.     break ; 
  324.       case 11 : 
  325.       case 9 : 
  326.     x = x + mem [ p + 1 ] .cint ; 
  327.     break ; 
  328.       case 6 : 
  329.     {
  330.       mem [ memtop - 12 ] = mem [ p + 1 ] ; 
  331.       mem [ memtop - 12 ] .hh .v.RH = mem [ p ] .hh .v.RH ; 
  332.       p = memtop - 12 ; 
  333.       goto lab21 ; 
  334.     } 
  335.     break ; 
  336.     default: 
  337.     ; 
  338.     break ; 
  339.       } 
  340.       p = mem [ p ] .hh .v.RH ; 
  341.     } 
  342.   } 
  343.   if ( adjusttail != 0 ) 
  344.   mem [ adjusttail ] .hh .v.RH = 0 ; 
  345.   mem [ r + 3 ] .cint = h ; 
  346.   mem [ r + 2 ] .cint = d ; 
  347.   if ( m == 1 ) 
  348.   w = x + w ; 
  349.   mem [ r + 1 ] .cint = w ; 
  350.   x = w - x ; 
  351.   if ( x == 0 ) 
  352.   {
  353.     mem [ r + 5 ] .hh.b0 = 0 ; 
  354.     mem [ r + 5 ] .hh.b1 = 0 ; 
  355.     mem [ r + 6 ] .gr = 0.0 ; 
  356.     goto lab10 ; 
  357.   } 
  358.   else if ( x > 0 ) 
  359.   {
  360.     if ( totalstretch [ 3 ] != 0 ) 
  361.     o = 3 ; 
  362.     else if ( totalstretch [ 2 ] != 0 ) 
  363.     o = 2 ; 
  364.     else if ( totalstretch [ 1 ] != 0 ) 
  365.     o = 1 ; 
  366.     else o = 0 ; 
  367.     mem [ r + 5 ] .hh.b1 = o ; 
  368.     mem [ r + 5 ] .hh.b0 = 1 ; 
  369.     if ( totalstretch [ o ] != 0 ) 
  370.     mem [ r + 6 ] .gr = x / ((double) totalstretch [ o ] ) ; 
  371.     else {
  372.     
  373.       mem [ r + 5 ] .hh.b0 = 0 ; 
  374.       mem [ r + 6 ] .gr = 0.0 ; 
  375.     } 
  376.     if ( o == 0 ) 
  377.     if ( mem [ r + 5 ] .hh .v.RH != 0 ) 
  378.     {
  379.       lastbadness = badness ( x , totalstretch [ 0 ] ) ; 
  380.       if ( lastbadness > eqtb [ 6189 ] .cint ) 
  381.       {
  382.     println () ; 
  383.     if ( lastbadness > 100 ) 
  384.     printnl ( 837 ) ; 
  385.     else printnl ( 838 ) ; 
  386.     print ( 839 ) ; 
  387.     printint ( lastbadness ) ; 
  388.     goto lab50 ; 
  389.       } 
  390.     } 
  391.     goto lab10 ; 
  392.   } 
  393.   else {
  394.       
  395.     if ( totalshrink [ 3 ] != 0 ) 
  396.     o = 3 ; 
  397.     else if ( totalshrink [ 2 ] != 0 ) 
  398.     o = 2 ; 
  399.     else if ( totalshrink [ 1 ] != 0 ) 
  400.     o = 1 ; 
  401.     else o = 0 ; 
  402.     mem [ r + 5 ] .hh.b1 = o ; 
  403.     mem [ r + 5 ] .hh.b0 = 2 ; 
  404.     if ( totalshrink [ o ] != 0 ) 
  405.     mem [ r + 6 ] .gr = ( - (integer) x ) / ((double) totalshrink [ o ] ) ; 
  406.     else {
  407.     
  408.       mem [ r + 5 ] .hh.b0 = 0 ; 
  409.       mem [ r + 6 ] .gr = 0.0 ; 
  410.     } 
  411.     if ( ( totalshrink [ o ] < - (integer) x ) && ( o == 0 ) && ( mem [ r + 5 
  412.     ] .hh .v.RH != 0 ) ) 
  413.     {
  414.       lastbadness = 1000000L ; 
  415.       mem [ r + 6 ] .gr = 1.0 ; 
  416.       if ( ( - (integer) x - totalshrink [ 0 ] > eqtb [ 6738 ] .cint ) || ( 
  417.       eqtb [ 6189 ] .cint < 100 ) ) 
  418.       {
  419.     if ( ( eqtb [ 6746 ] .cint > 0 ) && ( - (integer) x - totalshrink [ 0 
  420.     ] > eqtb [ 6738 ] .cint ) ) 
  421.     {
  422.       while ( mem [ q ] .hh .v.RH != 0 ) q = mem [ q ] .hh .v.RH ; 
  423.       mem [ q ] .hh .v.RH = newrule () ; 
  424.       mem [ mem [ q ] .hh .v.RH + 1 ] .cint = eqtb [ 6746 ] .cint ; 
  425.     } 
  426.     println () ; 
  427.     printnl ( 845 ) ; 
  428.     printscaled ( - (integer) x - totalshrink [ 0 ] ) ; 
  429.     print ( 846 ) ; 
  430.     goto lab50 ; 
  431.       } 
  432.     } 
  433.     else if ( o == 0 ) 
  434.     if ( mem [ r + 5 ] .hh .v.RH != 0 ) 
  435.     {
  436.       lastbadness = badness ( - (integer) x , totalshrink [ 0 ] ) ; 
  437.       if ( lastbadness > eqtb [ 6189 ] .cint ) 
  438.       {
  439.     println () ; 
  440.     printnl ( 847 ) ; 
  441.     printint ( lastbadness ) ; 
  442.     goto lab50 ; 
  443.       } 
  444.     } 
  445.     goto lab10 ; 
  446.   } 
  447.   lab50: if ( outputactive ) 
  448.   print ( 840 ) ; 
  449.   else {
  450.       
  451.     if ( packbeginline != 0 ) 
  452.     {
  453.       if ( packbeginline > 0 ) 
  454.       print ( 841 ) ; 
  455.       else print ( 842 ) ; 
  456.       printint ( abs ( packbeginline ) ) ; 
  457.       print ( 843 ) ; 
  458.     } 
  459.     else print ( 844 ) ; 
  460.     printint ( line ) ; 
  461.   } 
  462.   println () ; 
  463.   fontinshortdisplay = 0 ; 
  464.   shortdisplay ( mem [ r + 5 ] .hh .v.RH ) ; 
  465.   println () ; 
  466.   begindiagnostic () ; 
  467.   showbox ( r ) ; 
  468.   enddiagnostic ( true ) ; 
  469.   lab10: Result = r ; 
  470.   return(Result) ; 
  471. halfword zvpackage ( p , h , m , l ) 
  472. halfword p ; 
  473. scaled h ; 
  474. smallnumber m ; 
  475. scaled l ; 
  476. {/* 50 10 */ register halfword Result; vpackage_regmem 
  477.   halfword r  ; 
  478.   scaled w, d, x  ; 
  479.   scaled s  ; 
  480.   halfword g  ; 
  481.   glueord o  ; 
  482.   lastbadness = 0 ; 
  483.   r = getnode ( 7 ) ; 
  484.   mem [ r ] .hh.b0 = 1 ; 
  485.   mem [ r ] .hh.b1 = 0 ; 
  486.   mem [ r + 4 ] .cint = 0 ; 
  487.   mem [ r + 5 ] .hh .v.RH = p ; 
  488.   w = 0 ; 
  489.   d = 0 ; 
  490.   x = 0 ; 
  491.   totalstretch [ 0 ] = 0 ; 
  492.   totalshrink [ 0 ] = 0 ; 
  493.   totalstretch [ 1 ] = 0 ; 
  494.   totalshrink [ 1 ] = 0 ; 
  495.   totalstretch [ 2 ] = 0 ; 
  496.   totalshrink [ 2 ] = 0 ; 
  497.   totalstretch [ 3 ] = 0 ; 
  498.   totalshrink [ 3 ] = 0 ; 
  499.   while ( p != 0 ) {
  500.       
  501.     if ( ( p >= himemmin ) ) 
  502.     confusion ( 848 ) ; 
  503.     else switch ( mem [ p ] .hh.b0 ) 
  504.     {case 0 : 
  505.     case 1 : 
  506.     case 2 : 
  507.     case 13 : 
  508.       {
  509.     x = x + d + mem [ p + 3 ] .cint ; 
  510.     d = mem [ p + 2 ] .cint ; 
  511.     if ( mem [ p ] .hh.b0 >= 2 ) 
  512.     s = 0 ; 
  513.     else s = mem [ p + 4 ] .cint ; 
  514.     if ( mem [ p + 1 ] .cint + s > w ) 
  515.     w = mem [ p + 1 ] .cint + s ; 
  516.       } 
  517.       break ; 
  518.     case 8 : 
  519.       ; 
  520.       break ; 
  521.     case 10 : 
  522.       {
  523.     x = x + d ; 
  524.     d = 0 ; 
  525.     g = mem [ p + 1 ] .hh .v.LH ; 
  526.     x = x + mem [ g + 1 ] .cint ; 
  527.     o = mem [ g ] .hh.b0 ; 
  528.     totalstretch [ o ] = totalstretch [ o ] + mem [ g + 2 ] .cint ; 
  529.     o = mem [ g ] .hh.b1 ; 
  530.     totalshrink [ o ] = totalshrink [ o ] + mem [ g + 3 ] .cint ; 
  531.     if ( mem [ p ] .hh.b1 >= 100 ) 
  532.     {
  533.       g = mem [ p + 1 ] .hh .v.RH ; 
  534.       if ( mem [ g + 1 ] .cint > w ) 
  535.       w = mem [ g + 1 ] .cint ; 
  536.     } 
  537.       } 
  538.       break ; 
  539.     case 11 : 
  540.       {
  541.     x = x + d + mem [ p + 1 ] .cint ; 
  542.     d = 0 ; 
  543.       } 
  544.       break ; 
  545.       default: 
  546.       ; 
  547.       break ; 
  548.     } 
  549.     p = mem [ p ] .hh .v.RH ; 
  550.   } 
  551.   mem [ r + 1 ] .cint = w ; 
  552.   if ( d > l ) 
  553.   {
  554.     x = x + d - l ; 
  555.     mem [ r + 2 ] .cint = l ; 
  556.   } 
  557.   else mem [ r + 2 ] .cint = d ; 
  558.   if ( m == 1 ) 
  559.   h = x + h ; 
  560.   mem [ r + 3 ] .cint = h ; 
  561.   x = h - x ; 
  562.   if ( x == 0 ) 
  563.   {
  564.     mem [ r + 5 ] .hh.b0 = 0 ; 
  565.     mem [ r + 5 ] .hh.b1 = 0 ; 
  566.     mem [ r + 6 ] .gr = 0.0 ; 
  567.     goto lab10 ; 
  568.   } 
  569.   else if ( x > 0 ) 
  570.   {
  571.     if ( totalstretch [ 3 ] != 0 ) 
  572.     o = 3 ; 
  573.     else if ( totalstretch [ 2 ] != 0 ) 
  574.     o = 2 ; 
  575.     else if ( totalstretch [ 1 ] != 0 ) 
  576.     o = 1 ; 
  577.     else o = 0 ; 
  578.     mem [ r + 5 ] .hh.b1 = o ; 
  579.     mem [ r + 5 ] .hh.b0 = 1 ; 
  580.     if ( totalstretch [ o ] != 0 ) 
  581.     mem [ r + 6 ] .gr = x / ((double) totalstretch [ o ] ) ; 
  582.     else {
  583.     
  584.       mem [ r + 5 ] .hh.b0 = 0 ; 
  585.       mem [ r + 6 ] .gr = 0.0 ; 
  586.     } 
  587.     if ( o == 0 ) 
  588.     if ( mem [ r + 5 ] .hh .v.RH != 0 ) 
  589.     {
  590.       lastbadness = badness ( x , totalstretch [ 0 ] ) ; 
  591.       if ( lastbadness > eqtb [ 6190 ] .cint ) 
  592.       {
  593.     println () ; 
  594.     if ( lastbadness > 100 ) 
  595.     printnl ( 837 ) ; 
  596.     else printnl ( 838 ) ; 
  597.     print ( 849 ) ; 
  598.     printint ( lastbadness ) ; 
  599.     goto lab50 ; 
  600.       } 
  601.     } 
  602.     goto lab10 ; 
  603.   } 
  604.   else {
  605.       
  606.     if ( totalshrink [ 3 ] != 0 ) 
  607.     o = 3 ; 
  608.     else if ( totalshrink [ 2 ] != 0 ) 
  609.     o = 2 ; 
  610.     else if ( totalshrink [ 1 ] != 0 ) 
  611.     o = 1 ; 
  612.     else o = 0 ; 
  613.     mem [ r + 5 ] .hh.b1 = o ; 
  614.     mem [ r + 5 ] .hh.b0 = 2 ; 
  615.     if ( totalshrink [ o ] != 0 ) 
  616.     mem [ r + 6 ] .gr = ( - (integer) x ) / ((double) totalshrink [ o ] ) ; 
  617.     else {
  618.     
  619.       mem [ r + 5 ] .hh.b0 = 0 ; 
  620.       mem [ r + 6 ] .gr = 0.0 ; 
  621.     } 
  622.     if ( ( totalshrink [ o ] < - (integer) x ) && ( o == 0 ) && ( mem [ r + 5 
  623.     ] .hh .v.RH != 0 ) ) 
  624.     {
  625.       lastbadness = 1000000L ; 
  626.       mem [ r + 6 ] .gr = 1.0 ; 
  627.       if ( ( - (integer) x - totalshrink [ 0 ] > eqtb [ 6739 ] .cint ) || ( 
  628.       eqtb [ 6190 ] .cint < 100 ) ) 
  629.       {
  630.     println () ; 
  631.     printnl ( 850 ) ; 
  632.     printscaled ( - (integer) x - totalshrink [ 0 ] ) ; 
  633.     print ( 851 ) ; 
  634.     goto lab50 ; 
  635.       } 
  636.     } 
  637.     else if ( o == 0 ) 
  638.     if ( mem [ r + 5 ] .hh .v.RH != 0 ) 
  639.     {
  640.       lastbadness = badness ( - (integer) x , totalshrink [ 0 ] ) ; 
  641.       if ( lastbadness > eqtb [ 6190 ] .cint ) 
  642.       {
  643.     println () ; 
  644.     printnl ( 852 ) ; 
  645.     printint ( lastbadness ) ; 
  646.     goto lab50 ; 
  647.       } 
  648.     } 
  649.     goto lab10 ; 
  650.   } 
  651.   lab50: if ( outputactive ) 
  652.   print ( 840 ) ; 
  653.   else {
  654.       
  655.     if ( packbeginline != 0 ) 
  656.     {
  657.       print ( 842 ) ; 
  658.       printint ( abs ( packbeginline ) ) ; 
  659.       print ( 843 ) ; 
  660.     } 
  661.     else print ( 844 ) ; 
  662.     printint ( line ) ; 
  663.     println () ; 
  664.   } 
  665.   begindiagnostic () ; 
  666.   showbox ( r ) ; 
  667.   enddiagnostic ( true ) ; 
  668.   lab10: Result = r ; 
  669.   return(Result) ; 
  670. void zappendtovlist ( b ) 
  671. halfword b ; 
  672. {appendtovlist_regmem 
  673.   scaled d  ; 
  674.   halfword p  ; 
  675.   if ( curlist .auxfield .cint > -65536000L ) 
  676.   {
  677.     d = mem [ eqtb [ 3783 ] .hh .v.RH + 1 ] .cint - curlist .auxfield .cint - 
  678.     mem [ b + 3 ] .cint ; 
  679.     if ( d < eqtb [ 6732 ] .cint ) 
  680.     p = newparamglue ( 0 ) ; 
  681.     else {
  682.     
  683.       p = newskipparam ( 1 ) ; 
  684.       mem [ tempptr + 1 ] .cint = d ; 
  685.     } 
  686.     mem [ curlist .tailfield ] .hh .v.RH = p ; 
  687.     curlist .tailfield = p ; 
  688.   } 
  689.   mem [ curlist .tailfield ] .hh .v.RH = b ; 
  690.   curlist .tailfield = b ; 
  691.   curlist .auxfield .cint = mem [ b + 2 ] .cint ; 
  692. halfword newnoad ( ) 
  693. {register halfword Result; newnoad_regmem 
  694.   halfword p  ; 
  695.   p = getnode ( 4 ) ; 
  696.   mem [ p ] .hh.b0 = 16 ; 
  697.   mem [ p ] .hh.b1 = 0 ; 
  698.   mem [ p + 1 ] .hh = emptyfield ; 
  699.   mem [ p + 3 ] .hh = emptyfield ; 
  700.   mem [ p + 2 ] .hh = emptyfield ; 
  701.   Result = p ; 
  702.   return(Result) ; 
  703. halfword znewstyle ( s ) 
  704. smallnumber s ; 
  705. {register halfword Result; newstyle_regmem 
  706.   halfword p  ; 
  707.   p = getnode ( 3 ) ; 
  708.   mem [ p ] .hh.b0 = 14 ; 
  709.   mem [ p ] .hh.b1 = s ; 
  710.   mem [ p + 1 ] .cint = 0 ; 
  711.   mem [ p + 2 ] .cint = 0 ; 
  712.   Result = p ; 
  713.   return(Result) ; 
  714. halfword newchoice ( ) 
  715. {register halfword Result; newchoice_regmem 
  716.   halfword p  ; 
  717.   p = getnode ( 3 ) ; 
  718.   mem [ p ] .hh.b0 = 15 ; 
  719.   mem [ p ] .hh.b1 = 0 ; 
  720.   mem [ p + 1 ] .hh .v.LH = 0 ; 
  721.   mem [ p + 1 ] .hh .v.RH = 0 ; 
  722.   mem [ p + 2 ] .hh .v.LH = 0 ; 
  723.   mem [ p + 2 ] .hh .v.RH = 0 ; 
  724.   Result = p ; 
  725.   return(Result) ; 
  726. void showinfo ( ) 
  727. {showinfo_regmem 
  728.   shownodelist ( mem [ tempptr ] .hh .v.LH ) ; 
  729. halfword zfractionrule ( t ) 
  730. scaled t ; 
  731. {register halfword Result; fractionrule_regmem 
  732.   halfword p  ; 
  733.   p = newrule () ; 
  734.   mem [ p + 3 ] .cint = t ; 
  735.   mem [ p + 2 ] .cint = 0 ; 
  736.   Result = p ; 
  737.   return(Result) ; 
  738. halfword zoverbar ( b , k , t ) 
  739. halfword b ; 
  740. scaled k ; 
  741. scaled t ; 
  742. {register halfword Result; overbar_regmem 
  743.   halfword p, q  ; 
  744.   p = newkern ( k ) ; 
  745.   mem [ p ] .hh .v.RH = b ; 
  746.   q = fractionrule ( t ) ; 
  747.   mem [ q ] .hh .v.RH = p ; 
  748.   p = newkern ( t ) ; 
  749.   mem [ p ] .hh .v.RH = q ; 
  750.   Result = vpackage ( p , 0 , 1 , 1073741823L ) ; 
  751.   return(Result) ; 
  752. halfword zcharbox ( f , c ) 
  753. internalfontnumber f ; 
  754. quarterword c ; 
  755. {register halfword Result; charbox_regmem 
  756.   fourquarters q  ; 
  757.   eightbits hd  ; 
  758.   halfword b, p  ; 
  759.   q = fontinfo [ charbase [ f ] + c ] .qqqq ; 
  760.   hd = q .b1 ; 
  761.   b = newnullbox () ; 
  762.   mem [ b + 1 ] .cint = fontinfo [ widthbase [ f ] + q .b0 ] .cint + fontinfo 
  763.   [ italicbase [ f ] + ( q .b2 ) / 4 ] .cint ; 
  764.   mem [ b + 3 ] .cint = fontinfo [ heightbase [ f ] + ( hd ) / 16 ] .cint ; 
  765.   mem [ b + 2 ] .cint = fontinfo [ depthbase [ f ] + ( hd ) % 16 ] .cint ; 
  766.   p = getavail () ; 
  767.   mem [ p ] .hh.b1 = c ; 
  768.   mem [ p ] .hh.b0 = f ; 
  769.   mem [ b + 5 ] .hh .v.RH = p ; 
  770.   Result = b ; 
  771.   return(Result) ; 
  772. void zstackintobox ( b , f , c ) 
  773. halfword b ; 
  774. internalfontnumber f ; 
  775. quarterword c ; 
  776. {stackintobox_regmem 
  777.   halfword p  ; 
  778.   p = charbox ( f , c ) ; 
  779.   mem [ p ] .hh .v.RH = mem [ b + 5 ] .hh .v.RH ; 
  780.   mem [ b + 5 ] .hh .v.RH = p ; 
  781.   mem [ b + 3 ] .cint = mem [ p + 3 ] .cint ; 
  782. scaled zheightplusdepth ( f , c ) 
  783. internalfontnumber f ; 
  784. quarterword c ; 
  785. {register scaled Result; heightplusdepth_regmem 
  786.   fourquarters q  ; 
  787.   eightbits hd  ; 
  788.   q = fontinfo [ charbase [ f ] + c ] .qqqq ; 
  789.   hd = q .b1 ; 
  790.   Result = fontinfo [ heightbase [ f ] + ( hd ) / 16 ] .cint + fontinfo [ 
  791.   depthbase [ f ] + ( hd ) % 16 ] .cint ; 
  792.   return(Result) ; 
  793. halfword zvardelimiter ( d , s , v ) 
  794. halfword d ; 
  795. smallnumber s ; 
  796. scaled v ; 
  797. {/* 40 22 */ register halfword Result; vardelimiter_regmem 
  798.   halfword b  ; 
  799.   internalfontnumber f, g  ; 
  800.   quarterword c, x, y  ; 
  801.   integer m, n  ; 
  802.   scaled u  ; 
  803.   scaled w  ; 
  804.   fourquarters q  ; 
  805.   eightbits hd  ; 
  806.   fourquarters r  ; 
  807.   smallnumber z  ; 
  808.   boolean largeattempt  ; 
  809.   f = 0 ; 
  810.   w = 0 ; 
  811.   largeattempt = false ; 
  812.   z = mem [ d ] .qqqq .b0 ; 
  813.   x = mem [ d ] .qqqq .b1 ; 
  814.   while ( true ) {
  815.       
  816.     if ( ( z != 0 ) || ( x != 0 ) ) 
  817.     {
  818.       z = z + s + 16 ; 
  819.       do {
  820.       z = z - 16 ; 
  821.     g = eqtb [ 4835 + z ] .hh .v.RH ; 
  822.     if ( g != 0 ) 
  823.     {
  824.       y = x ; 
  825.       if ( ( y >= fontbc [ g ] ) && ( y <= fontec [ g ] ) ) 
  826.       {
  827.         lab22: q = fontinfo [ charbase [ g ] + y ] .qqqq ; 
  828.         if ( ( q .b0 > 0 ) ) 
  829.         {
  830.           if ( ( ( q .b2 ) % 4 ) == 3 ) 
  831.           {
  832.         f = g ; 
  833.         c = y ; 
  834.         goto lab40 ; 
  835.           } 
  836.           hd = q .b1 ; 
  837.           u = fontinfo [ heightbase [ g ] + ( hd ) / 16 ] .cint + fontinfo 
  838.           [ depthbase [ g ] + ( hd ) % 16 ] .cint ; 
  839.           if ( u > w ) 
  840.           {
  841.         f = g ; 
  842.         c = y ; 
  843.         w = u ; 
  844.         if ( u >= v ) 
  845.         goto lab40 ; 
  846.           } 
  847.           if ( ( ( q .b2 ) % 4 ) == 2 ) 
  848.           {
  849.         y = q .b3 ; 
  850.         goto lab22 ; 
  851.           } 
  852.         } 
  853.       } 
  854.     } 
  855.       } while ( ! ( z < 16 ) ) ; 
  856.     } 
  857.     if ( largeattempt ) 
  858.     goto lab40 ; 
  859.     largeattempt = true ; 
  860.     z = mem [ d ] .qqqq .b2 ; 
  861.     x = mem [ d ] .qqqq .b3 ; 
  862.   } 
  863.   lab40: if ( f != 0 ) 
  864.   if ( ( ( q .b2 ) % 4 ) == 3 ) 
  865.   {
  866.     b = newnullbox () ; 
  867.     mem [ b ] .hh.b0 = 1 ; 
  868.     r = fontinfo [ extenbase [ f ] + q .b3 ] .qqqq ; 
  869.     c = r .b3 ; 
  870.     u = heightplusdepth ( f , c ) ; 
  871.     w = 0 ; 
  872.     q = fontinfo [ charbase [ f ] + c ] .qqqq ; 
  873.     mem [ b + 1 ] .cint = fontinfo [ widthbase [ f ] + q .b0 ] .cint + 
  874.     fontinfo [ italicbase [ f ] + ( q .b2 ) / 4 ] .cint ; 
  875.     c = r .b2 ; 
  876.     if ( c != 0 ) 
  877.     w = w + heightplusdepth ( f , c ) ; 
  878.     c = r .b1 ; 
  879.     if ( c != 0 ) 
  880.     w = w + heightplusdepth ( f , c ) ; 
  881.     c = r .b0 ; 
  882.     if ( c != 0 ) 
  883.     w = w + heightplusdepth ( f , c ) ; 
  884.     n = 0 ; 
  885.     if ( u > 0 ) 
  886.     while ( w < v ) {
  887.     
  888.       w = w + u ; 
  889.       incr ( n ) ; 
  890.       if ( r .b1 != 0 ) 
  891.       w = w + u ; 
  892.     } 
  893.     c = r .b2 ; 
  894.     if ( c != 0 ) 
  895.     stackintobox ( b , f , c ) ; 
  896.     c = r .b3 ; 
  897.     {register integer for_end; m = 1 ; for_end = n ; if ( m <= for_end) do 
  898.       stackintobox ( b , f , c ) ; 
  899.     while ( m++ < for_end ) ; } 
  900.     c = r .b1 ; 
  901.     if ( c != 0 ) 
  902.     {
  903.       stackintobox ( b , f , c ) ; 
  904.       c = r .b3 ; 
  905.       {register integer for_end; m = 1 ; for_end = n ; if ( m <= for_end) do 
  906.     stackintobox ( b , f , c ) ; 
  907.       while ( m++ < for_end ) ; } 
  908.     } 
  909.     c = r .b0 ; 
  910.     if ( c != 0 ) 
  911.     stackintobox ( b , f , c ) ; 
  912.     mem [ b + 2 ] .cint = w - mem [ b + 3 ] .cint ; 
  913.   } 
  914.   else b = charbox ( f , c ) ; 
  915.   else {
  916.       
  917.     b = newnullbox () ; 
  918.     mem [ b + 1 ] .cint = eqtb [ 6741 ] .cint ; 
  919.   } 
  920.   mem [ b + 4 ] .cint = half ( mem [ b + 3 ] .cint - mem [ b + 2 ] .cint ) - 
  921.   fontinfo [ 22 + parambase [ eqtb [ 4837 + s ] .hh .v.RH ] ] .cint ; 
  922.   Result = b ; 
  923.   return(Result) ; 
  924. halfword zrebox ( b , w ) 
  925. halfword b ; 
  926. scaled w ; 
  927. {register halfword Result; rebox_regmem 
  928.   halfword p  ; 
  929.   internalfontnumber f  ; 
  930.   scaled v  ; 
  931.   if ( ( mem [ b + 1 ] .cint != w ) && ( mem [ b + 5 ] .hh .v.RH != 0 ) ) 
  932.   {
  933.     if ( mem [ b ] .hh.b0 == 1 ) 
  934.     b = hpack ( b , 0 , 1 ) ; 
  935.     p = mem [ b + 5 ] .hh .v.RH ; 
  936.     if ( ( ( p >= himemmin ) ) && ( mem [ p ] .hh .v.RH == 0 ) ) 
  937.     {
  938.       f = mem [ p ] .hh.b0 ; 
  939.       v = fontinfo [ widthbase [ f ] + fontinfo [ charbase [ f ] + mem [ p ] 
  940.       .hh.b1 ] .qqqq .b0 ] .cint ; 
  941.       if ( v != mem [ b + 1 ] .cint ) 
  942.       mem [ p ] .hh .v.RH = newkern ( mem [ b + 1 ] .cint - v ) ; 
  943.     } 
  944.     freenode ( b , 7 ) ; 
  945.     b = newglue ( 12 ) ; 
  946.     mem [ b ] .hh .v.RH = p ; 
  947.     while ( mem [ p ] .hh .v.RH != 0 ) p = mem [ p ] .hh .v.RH ; 
  948.     mem [ p ] .hh .v.RH = newglue ( 12 ) ; 
  949.     Result = hpack ( b , w , 0 ) ; 
  950.   } 
  951.   else {
  952.       
  953.     mem [ b + 1 ] .cint = w ; 
  954.     Result = b ; 
  955.   } 
  956.   return(Result) ; 
  957. halfword zmathglue ( g , m ) 
  958. halfword g ; 
  959. scaled m ; 
  960. {register halfword Result; mathglue_regmem 
  961.   halfword p  ; 
  962.   integer n  ; 
  963.   scaled f  ; 
  964.   n = xovern ( m , 65536L ) ; 
  965.   f = remainder ; 
  966.   p = getnode ( 4 ) ; 
  967.   mem [ p + 1 ] .cint = multandadd ( n , mem [ g + 1 ] .cint , xnoverd ( mem [ 
  968.   g + 1 ] .cint , f , 65536L ) , 1073741823L ) ; 
  969.   mem [ p ] .hh.b0 = mem [ g ] .hh.b0 ; 
  970.   if ( mem [ p ] .hh.b0 == 0 ) 
  971.   mem [ p + 2 ] .cint = multandadd ( n , mem [ g + 2 ] .cint , xnoverd ( mem [ 
  972.   g + 2 ] .cint , f , 65536L ) , 1073741823L ) ; 
  973.   else mem [ p + 2 ] .cint = mem [ g + 2 ] .cint ; 
  974.   mem [ p ] .hh.b1 = mem [ g ] .hh.b1 ; 
  975.   if ( mem [ p ] .hh.b1 == 0 ) 
  976.   mem [ p + 3 ] .cint = multandadd ( n , mem [ g + 3 ] .cint , xnoverd ( mem [ 
  977.   g + 3 ] .cint , f , 65536L ) , 1073741823L ) ; 
  978.   else mem [ p + 3 ] .cint = mem [ g + 3 ] .cint ; 
  979.   Result = p ; 
  980.   return(Result) ; 
  981. void zmathkern ( p , m ) 
  982. halfword p ; 
  983. scaled m ; 
  984. {mathkern_regmem 
  985.   integer n  ; 
  986.   scaled f  ; 
  987.   if ( mem [ p ] .hh.b1 == 99 ) 
  988.   {
  989.     n = xovern ( m , 65536L ) ; 
  990.     f = remainder ; 
  991.     mem [ p + 1 ] .cint = multandadd ( n , mem [ p + 1 ] .cint , xnoverd ( mem 
  992.     [ p + 1 ] .cint , f , 65536L ) , 1073741823L ) ; 
  993.     mem [ p ] .hh.b1 = 0 ; 
  994.   } 
  995.